package model.entity.product;

import java.beans.Transient;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "Color")
public class Color {

	private int colorId;
	private String name;
	private String shortInfo;

	public Color() {
	}

	public Color(String name) {
		this.name = name;
	}

	public Color(String name, String shortInfo) {
		this.name = name;
		this.shortInfo = shortInfo;
	}

	@Id
	@GeneratedValue(generator = "Color_ID_Gen", strategy = GenerationType.IDENTITY)
	@SequenceGenerator(name = "Color_ID_Gen", sequenceName = "Color_SEQ_ID")
	@Column(name = "ColorID", unique = true, nullable = false)
	public int getColorId() {
		return this.colorId;
	}

	public void setColorId(int colorId) {
		this.colorId = colorId;
	}

	@Column(name = "Name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "ShortInfo")
	public String getShortInfo() {
		return this.shortInfo;
	}

	public void setShortInfo(String shortInfo) {
		this.shortInfo = shortInfo;
	}

	public String layColorRGBCode() {
		return shortInfo.substring(5, shortInfo.length());
	}
}
